home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date:
- // Author:
- //
-
- global proc buildPanelSubItemsNow (string $subMenuName, string $panelName) {
-
- setParent -m $subMenuName;
- if (0 == `menu -q -numberOfItems $subMenuName`) {
- newPanelItems $panelName;
- }
-
- }
-
- global proc buildOtherPanelSubItemsNow (string $subMenuName, string $panelName)
- {
- string $state[];
- int $count = 0;
- string $label;
-
- string $panels[] = `getPanel -allPanels`;
-
- for ($panel in $panels) {
- string $type = `getPanel -typeOf $panel`;
- $label = `panel -q -label $panel`;
-
- // Skip Top, Front, Side, and Persp Panels
- //
- if (($type != "modelPanel" ||
- ("Top View" != $label && "Front View" != $label &&
- "Side View" != $label && "Persp View" != $label)) &&
- $type != "emptyPanel")
- {
- string $realType;
- if ($type == "scriptedPanel") {
- $realType = `scriptedPanel -q -type $panel`;
- } else {
- $realType = $type;
- }
- if ( ( $realType == "blendShapePanel")
- && (!`licenseCheck -m "edit" -typ "complete"`)) {
- //
- // The user needs a Maya Complete license to use
- // the BlendShape panel, so don't
- // bother offerring it as a choice (would just
- // bring up a useless blank panel anyway)
- continue;
- }
- $state[$count++] = $panel;
- $state[$count++] = `panel -q -to $panel`;
- }
- }
-
- if (associateWithKey($subMenuName, $state)) return;
-
- // Rebuild menu
- //
-
- setParent -m $subMenuName;
-
- popupMenu -e -deleteAllItems $subMenuName;
-
- string $command;
- string $item;
- int $kNumItemsPerDivider = 3;
-
- $count = 0;
- for ($i in $panels) {
-
- if ($count > 0 && ($count%$kNumItemsPerDivider == 0)) {
- menuItem -divider true;
- }
-
- $command = `getPanel -typeOf $i`;
- $label = `panel -q -label $i`;
-
- // Skip Top, Front, Side, and Persp Panels
- //
- if (($command != "modelPanel" ||
- ("Top View" != $label && "Front View" != $label &&
- "Side View" != $label && "Persp View" != $label)) &&
- $command != "emptyPanel")
- {
- string $realType;
- if ($command == "scriptedPanel") {
- $realType = `scriptedPanel -q -type $i`;
- } else {
- $realType = $command;
- }
- if ( ( $realType == "blendShapePanel")
- && (!`licenseCheck -m "edit" -typ "complete"`)) {
- //
- // The user needs a Maya Complete license to use
- // the BlendShape panel, so don't
- // bother offerring it as a choice (would just
- // bring up a useless blank panel anyway)
- continue;
- }
- $item = `menuItem -l $label -ecr false
- -c ($command+" -e -rp "+$panelName+" "+$i)`;
-
- if (`panel -q -to $i`) {
- menuItem -e -enable false $item;
- }
- $count++;
- }
- }
- }
-
- global proc buildNamedArrangementsNow( string $menuName )
- {
- string $configLabel;
- string $arrs[];
- int $i;
- int $nArr = 0;
-
- menu -e -deleteAllItems $menuName;
- setParent -m $menuName;
-
- $arrs = `getPanel -allConfigs`;
- $nArr = size($arrs);
-
- for ($i = 0; $i < $nArr; $i++) {
- $configLabel = `panelConfiguration -q -l $arrs[$i]`;
- if ("Current Layout" != $configLabel) {
- menuItem -l $configLabel
- -annotation "Change layout of panels"
- -c ("setNamedPanelLayout \"" + $configLabel + "\"");
- }
- }
-
- menuItem -divider true;
- menuItem -l "Edit Layouts..."
- -annotation "Edit Layouts: Edit the panel layouts"
- -c "panelEditor \"Layouts\"";
- }
-
- global proc tearOffCopyItemCmd(string $panelType, string $srcPanel) {
-
- string $cmd;
- string $type;
-
- if ("scriptedPanel" == $panelType) {
- $type = `scriptedPanel -q -type $srcPanel`;
- $cmd = ("scriptedPanel -toc "+ $srcPanel +" -type "+ $type);
-
- } else {
- $cmd = ($panelType + " -toc " + $srcPanel);
- }
- $newName = `eval $cmd`;
- panel -e -label `interToUI $newName` $newName;
- }
-
- global proc buildPanelItemsNow ( string $panelName, string $menuName )
- {
- string $panelControl = `panel -q -control $panelName`;
-
- // if the menu name is specified, use it. Otherwise, assume
- // it is the pop-up menu and build the name appropriately.
- //
- string $popMenuName;
- if ( $menuName == "" ){
- $popMenuName = ($panelControl + "|" + $panelName + "Pop1");
- } else {
- $popMenuName = $menuName;
- }
- string $panelType = `getPanel -typeOf $panelName`;
- string $itemName;
-
- setParent -m $popMenuName;
-
- // The camera commands depend on the panel having focus for
- // getting the camera in the view.
- setFocus $panelName;
-
- if (0 != `menu -q -numberOfItems $popMenuName`) {
- if ($panelType == "modelPanel" && $menuName == "")
- menuItem -e -l `modelPanel -q -camera $panelName` menuTitle;
-
- return;
- }
-
- // Titles are only needed for pop-up menu
- //
- if ( $menuName == "" ){
- if ($panelType == "modelPanel"){
- menuItem -l `modelPanel -q -camera $panelName` menuTitle;
- }
- else {
- menuItem -l `panel -q -label $panelName` menuTitle;
- }
- menuItem -divider true;
- menuItem -divider true;
- }
-
- string $menu = `menuItem -l "Perspective" -subMenu true`;
- menuItem -e -postMenuCommand
- ("buildPerspLookthruMenu "+$menu+" "+$panelName) $menu;
- setParent -m ..;
-
- $menu = `menuItem -l "Orthographic" -subMenu true`;
- menuItem -e -postMenuCommand
- ("buildOrthoLookthruMenu "+$menu+" "+$panelName) $menu;
- setParent -m ..;
- menuItem -l "Look Through Selected"
- -command ("lookThroughSelected "+$panelName);
- menuItem -divider true;
-
- $menu = `menuItem -l "Panel" -subMenu true`;
- menuItem -e -postMenuCommand
- ("buildOtherPanelSubItemsNow "+$menu+" "+$panelName) $menu;
- setParent -m ..;
-
-
- menuItem -l "Layouts" -subMenu true -tearOff true;
- menuItem -label "Single Pane" -command "SingleViewArrangement"
- -annotation (getRunTimeCommandAnnotation("SingleViewArrangement"));
-
- menuItem -label "Two Panes Side by Side" -command "TwoSideBySideViewArrangement"
- -annotation (getRunTimeCommandAnnotation("TwoSideBySideViewArrangement"));
- menuItem -label "Two Panes Stacked" -command "TwoStackedViewArrangement"
- -annotation (getRunTimeCommandAnnotation("TwoStackedViewArrangement"));
-
- menuItem -label "Three Panes Split Top" -command "ThreeTopSplitViewArrangement"
- -annotation (getRunTimeCommandAnnotation("ThreeTopSplitViewArrangement"));
- menuItem -label "Three Panes Split Left" -command "ThreeLeftSplitViewArrangement"
- -annotation (getRunTimeCommandAnnotation("ThreeLeftSplitViewArrangement"));
- menuItem -label "Three Panes Split Bottom" -command "ThreeBottomSplitViewArrangement"
- -annotation (getRunTimeCommandAnnotation("ThreeBottomSplitViewArrangement"));
- menuItem -label "Three Panes Split Right" -command "ThreeRightSplitViewArrangement"
- -annotation (getRunTimeCommandAnnotation("ThreeRightSplitViewArrangement"));
-
- menuItem -label "Four Panes" -command "FourViewArrangement"
- -annotation (getRunTimeCommandAnnotation("FourViewArrangement"));
-
- menuItem -divider true;
-
- menuItem -label "Previous Arrangement" -command "PreviousViewArrangement"
- -annotation (getRunTimeCommandAnnotation("PreviousViewArrangement"));
- menuItem -label "Next Arrangement" -command "NextViewArrangement"
- -annotation (getRunTimeCommandAnnotation("NextViewArrangement"));
-
- setParent -menu ..;
-
- $menu = `menuItem -l "Saved Layouts" -subMenu true`;
- menuItem -e -pmc ("buildNamedArrangementsNow " + $menu) $menu;
- setParent -m ..;
-
-
- menuItem -divider true;
-
- menuItem -l "Tear Off..." -ecr false
- -c ($panelType + " -e -to " + $panelName + ";fillEmptyPanes;");
- $itemName = `menuItem -l "Tear Off Copy..." -ecr false
- -c ("tearOffCopyItemCmd " +$panelType + " " + $panelName)`;
- if (`panel -q -iu $panelName`) {
- menuItem -e -enable false $itemName;
- }
-
- menuItem -divider true;
-
- menuItem -l "Panel Editor..." -c "panelEditor \"Panels\"";
-
- // Create Context Sensitive Help Menu.
- //
- if (hasContextHelpProc($panelName))
- {
- doHelpSubMenu $panelName $menuName;
- }//if
- }
-
- global proc buildPanelPopupMenu (string $panelName) {
-
- // Build the common menu if it has not already been
- // built. (and this is not a torn-off panel)
- //
- if ( !`panel -q -tearOff $panelName` ) {
- string $panelControl = `panel -q -control $panelName`;
- if ( `menuBarLayout -exists $panelControl` ){
- setParent $panelControl;
- string $ma[] = `menuBarLayout -q -menuArray $panelControl`;
- int $found = 0;
- int $i;
- for ( $i=0; $i<size($ma) && $found == 0; $i++ ){
- if ( $ma[$i] == "Panels" ){
- $found = 1;
- }
- }
- if ( $found == 0 ){
- setParent $panelControl;
- string $menuName = `menu -helpMenu true
- -l "Panels"
- -familyImage "menuIconPanels.xpm"
- Panels`;
- menu -e -pmc ("buildPanelItemsNow "+$panelName+" "+$menuName) $menuName;
- }
- }
- } else {
- string $panelControl = `panel -q -control $panelName`;
- if ( `menuBarLayout -exists $panelControl` ){
- setParent $panelControl;
- string $ma[] = `menuBarLayout -q -menuArray $panelControl`;
- int $found = 0;
- int $i;
- // Check for existing Help Menu.
- //
- for ( $i=0; $i<size($ma) && $found == 0; $i++ ){
- if ( $ma[$i] == "HelpMenu" ){
- $found = 1;
- }
- }
- if ( $found == 0 ){
- doHelpMenu($panelName,$panelControl);
- }
- }
- }
- }
-
-
-
-